﻿Module Module1
    Public proxy As BCSchoolProxy.IBCSchool
    Public Function GetProxy() As BCSchoolProxy.IBCSchool
        If (proxy Is Nothing) Then
            proxy = New BCSchoolProxy.BCSchoolClient("tcpep") 'namedep,tcpep, httpep
        ElseIf (CType(proxy, BCSchoolProxy.BCSchoolClient).State = ServiceModel.CommunicationState.Faulted _
                Or CType(proxy, BCSchoolProxy.BCSchoolClient).State = ServiceModel.CommunicationState.Closed) Then
            proxy = New BCSchoolProxy.BCSchoolClient("tcpep") 'namedep,tcpep, httpep
        End If
        Return proxy
    End Function

    Sub Main()

        Console.WriteLine("Cliente")
        Console.ReadLine()
        System.Diagnostics.Trace.CorrelationManager.ActivityId = Guid.NewGuid
        Dim sw As New System.Diagnostics.Stopwatch
        sw.Start()
        For index = 1 To 2
            Try
                Dim p = GetProxy()
                Dim a As New BusinessEntities.Alumno
                a.id = Guid.NewGuid()
                a.nombre = "juan"
                a.edad = 15
                p.RegisterStudent(a)




            Catch ex As Exception
                Console.WriteLine(ex.Message)
            End Try
        Next
        sw.Stop()
        Console.WriteLine(sw.ElapsedMilliseconds)
        Console.ReadLine()
    End Sub

End Module
